import request from '@/config/axios'
import { StudentVO } from '@/api/recruit/recruitstudent' // 面试分组 VO

// 面试分组 VO
export interface InterviewGroupVO {
  id: string // 主键
  batchId: string // 计划ID
  interviewId: string // 面试ID
  groupName: string // 分组名称
  meetingNumber: string // 腾讯会议号
  meetingPassword: string // 参会密码
  qqGroupNumber: string // QQ群号
  specialistId1: number // 评委一ID
  specialistId2: number // 评委二ID
  specialistId3: number // 评委三ID
  remark: string // 备注
}

export interface InterviewGroupWithStudentSlotsSaveReqVO extends InterviewGroupVO {
  students: StudentVO[]
}

export interface InterviewGroupSimpleListRespVO {
  id: string // 主键
  batchId: string // 计划ID
  interviewId: string // 面试ID
  groupName: string // 分组名称
}

// 面试专家列表
export interface InterviewGroupSpecialListRespVO {
  groupId: string // 分组ID(主键)
  batchId: string // 计划ID
  interviewId: string // 面试ID
  batchName: string // 招生计划
  interviewDate: Date // 面试日期
  interviewStartTime: string // 开始时间
  interviewEndTime: string // 结束时间
  groupName: string // 分组名称
  interviewTimes: string // 面试时间段
  meetingNumber: string // 腾讯会议号
  meetingPassword: string // 参会密码
  qqGroupNumber: string // QQ群号
  specialistId1: number // 评委一ID
  specialistId2: number // 评委二ID
  specialistId3: number // 评委三ID
  specialistName1: string // 评委一
  specialistName2: string // 评委二
  specialistName3: string // 评委三
  amount: number // 面试学生数
}

// 面试分组 API
export const InterviewGroupApi = {
  // 查询面试分组分页
  getInterviewGroupPage: async (params: any) => {
    return await request.get({ url: `/recruit/interview-group/page`, params })
  },

  // 查询面试分组详情
  getInterviewGroup: async (id: string) => {
    return await request.get({ url: `/recruit/interview-group/get?id=` + id })
  },

  // 新增面试分组
  createInterviewGroup: async (data: InterviewGroupVO) => {
    return await request.post({ url: `/recruit/interview-group/create`, data })
  },

  // 修改面试分组
  updateInterviewGroup: async (data: InterviewGroupVO) => {
    return await request.put({ url: `/recruit/interview-group/update`, data })
  },

  // 删除面试分组
  deleteInterviewGroup: async (id: string) => {
    return await request.delete({ url: `/recruit/interview-group/delete?id=` + id })
  },

  // 导出面试分组 Excel
  exportInterviewGroup: async (params: any) => {
    return await request.download({ url: `/recruit/interview-group/export-excel`, params })
  },

  // 创建面试分组带给学生分槽位
  createInterviewGroupNew: async (data: InterviewGroupWithStudentSlotsSaveReqVO) => {
    return await request.post({ url: `/recruit/interview-group/create-new`, data })
  },

  // 修改面试分组带给学生分槽位
  updateInterviewGroupNew: async (data: InterviewGroupWithStudentSlotsSaveReqVO) => {
    return await request.put({ url: `/recruit/interview-group/update-new`, data })
  },

  // 获取指定日期的所有分组
  listByDate: async (date: string) => {
    return await request.get({ url: `/recruit/interview-group/list-by-date?date=${date}` })
  },

  // 获取指定面试下的所有分组下拉
  simpleList: async (interviewId: string) => {
    return await request.get({
      url: `/recruit/interview-group/simple-list?interviewId=${interviewId}`
    })
  },

  // 专家获得面试分组分页
  getInterviewGroupSpecialistPage: async (params: any) => {
    return await request.get({ url: `/recruit/interview-group/specialist-page`, params })
  }
}
